package com.fengmi.controller;

import com.fengmi.dto.PageDTO;
import com.fengmi.entity.MallGoodsCat;
import com.fengmi.entity.ViewCatTemp;
import com.fengmi.service.ViewCatTemplateService;
import com.fengmi.vo.PageResultVO;
import com.fengmi.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 123
 * @Date 2022/1/25 10:10
 * @Version 1.0
 */

@RestController
@RequestMapping("cat")
@CrossOrigin
public class ViewCatTemplateController {

    @Autowired
    private ViewCatTemplateService catTemplateService;

    @PostMapping("page/{pid}")
    public PageResultVO<ViewCatTemp> page(@RequestBody PageDTO<ViewCatTemp> pageDTO,@PathVariable String pid) {
        return catTemplateService.findCatTempByPage(pageDTO, pid);
    }

    @PostMapping("save")
    public ResultVO saveGoodsCat(@RequestBody MallGoodsCat mallGoodsCat) {
        return catTemplateService.save(mallGoodsCat);
    }
}